

const express = require('express');
const app = express();

const bodyParser = require('body-parser');

app.use(express.static('public'));

app.get('/login', (req, resp) => {
    let _data = req.query;
    console.log(_data);
    resp.send('get sucess');
});

// parse application/x-www-form-urlencoded , 参考: https://github.com/expressjs/body-parser
app.use(bodyParser.urlencoded({ extended: false }))

app.post('/login', (req, resp) => {
    let _data = req.body;
    console.log(_data);
    console.log(_data.username);
    resp.send('ok');
});

app.listen(3000, () => {
    console.log('running...');
});

